// latest.js
var Api = require('../../utils/api.js');

Page({
  data: {
    title: '全部节点',
    toView: 'green',
    nodes: [],
    hidden: false
  },
  fetchData: function() {
    var that = this;
    that.setData({
      hidden: false
    })
    wx.request({
      url: Api.getAllNode(),
      success: function(res) {
        console.log(res);
        that.setData({
          nodes: res.data.length >= 30 ? res.data.slice(1, 100) : res.data
        })
        setTimeout(function() {
          that.setData({
            hidden: true
          })
        }, 300)
      }
    })
  },
  onLoad: function () {
    this.fetchData();
  },

  upper(e) {
    console.log(e)
  },

  lower(e) {
    console.log(e)
  },

  scroll(e) {
    console.log(e)
  },

  scrollToTop() {
    this.setAction({
      scrollTop: 0
    })
  },

  tapMove() {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  }
})
